﻿using System;
using System.Runtime.InteropServices;
using System.Security.Permissions;

namespace BLL.Core
{
    [ComVisible(true)]
    public interface IServiceContainer : IServiceProvider
    {
        void AddService(Type serviceType, object serviceInstance);

        void AddService(Type serviceType, object serviceInstance, bool promote);

        void AddService(Type serviceType, ServiceCreatorCallback callback);

        void AddService(Type serviceType, ServiceCreatorCallback callback, bool promote);

        void RemoveService(Type serviceType);

        void RemoveService(Type serviceType, bool promote);
    }

    [ComVisible(true)]
    [HostProtection(SecurityAction.LinkDemand, SharedState = true)]
    public delegate object ServiceCreatorCallback(IServiceContainer container, Type serviceType);
}
